import speech_recognition as sr

def transcribe_audio(audio_path):
    r = sr.Recognizer()
    with sr.AudioFile(audio_path) as source:
        audio = r.record(source)
        text = r.recognize_google(audio, language='en-US')
        with open(output_path, 'w') as file:
            file.write(text)

# 示例用法
audio_path = "./folder/audio.wav"
output_path = "./folder/en_speech.txt"

transcription = transcribe_audio(audio_path)
print(transcription)